class MainDrop {
	Main: egret.DisplayObject;

	constructor(Main: egret.DisplayObject) {
		this.Main = Main;

		const div = window.document.getElementById('gameDiv');
		div.ondrop = (ev: DragEvent): void => this.onDrop(ev);
		div.ondragover = (e): void => e.preventDefault();
		div.ondragenter = (e): void => e.preventDefault();
	}

	onDrop(ev: DragEvent): void {
		// console.log("MainWindow.onDrop",ev.dataTransfer.files)
		const [x, y] = mouse2Game(ev.x, ev.y, this.Main);
		console.log(
			'MainWindow.onDrop',
			ev.offsetX,
			ev.offsetY,
			ev.x,
			ev.y,
			Math.floor(x),
			Math.floor(y),
		);

		if (ev.dataTransfer.files.length > 0) {
			// eslint-disable-next-line dot-notation
			const file = ev.dataTransfer.files[0]['path'];
			// MainFrame.ins().openFile(FsUtils.window2linuxFile(file), x, y);
		}
		// ev.preventDefault();
	}
}
